<extend name="Common:base" />

<block name="title"><title>历史订单 - 爱读书店</title></block>

<block name="stylesheet">
<link rel="stylesheet" href="__CSS__/common.css" id="colors">
</block>

<block name="breadcrumbs">
<!-- Titlebar -->
<section class="titlebar">
  <div class="container">
    <div class="sixteen columns">
      <h2>历史订单</h2>

      <nav id="breadcrumbs">
        <ul>
          <li><a href="{:U('Index/index')}">首页</a></li>
          <li><a href="{:U('Account/index')}">个人档案</a></li>
          <li>历史订单</li>
        </ul>
      </nav>

    </div>
  </div>
</section>
</block>

<block name="main-content">
<!-- Container -->
<div class="container cart">
  <!-- Cart Totals -->
  <div class="sixteen columns">
    <h3 class="headline">我的历史订单</h3><span class="line margin-bottom-35"></span><div class="clearfix"></div>
  </div>

  <div class="sixteen columns">


  
  <table class="cart-table responsive-table stacktable">
      <tbody>
      <tr>
        <th>订单号</th>
        <th>订单物品</th>
        <th>订单金额</th>
        <th>创建时间</th>
        <th>当前状态</th>
      </tr>

      <foreach name="orders_list" item="o">
      <tr>
        <td>{$o['id']}</td>
        <td>
          <a href="{:U('Order/detail', array('id' => $o['id']))}">
          <foreach name="o['items']" item='b' key="k">
          {$b['title']}<br />
          </foreach>
          </a>
        </td>
        <td>
          {/* 下面是一段原生的PHP代码, 用于计算此订单的总金额, 将来的模板只需拷贝这段代码即可 */}
          <?php
          $total = 0;
          foreach ($o['items'] as $item) {
              $total += $item['quantity'] * $item['price'];
          }
          echo $total;
          ?>
        </td>
        <td>{$o.time|date='Y-m-d H:i:s', ###}</td>
        <td>
          <switch name="o['status']">
          <case value="0">订单未支付</case>
          <case value="1">订单人工确认中</case>
          <case value="2">即将发货</case>
          <case value="3">已经发货</case>
          <case value="4">交易完成</case>
          <case value="5">交易关闭</case>
          <default />未知状态
          </switch>
        </td>
      </tr>
      </foreach>

    </tbody></table>

    <br>

    <!-- Share Buttons -->	
    <div class="share-buttons">
      <ul>
        <li class="active"><a href="wishlist.html#">Share</a></li>
        <li style="display: none;" class="share-facebook"><a href="wishlist.html#">Facebook</a></li>
        <li style="display: none;" class="share-twitter"><a href="wishlist.html#">Twitter</a></li>
        <li style="display: none;" class="share-gplus"><a href="wishlist.html#">Google Plus</a></li>
        <li style="display: none;" class="share-pinit"><a href="wishlist.html#">Pin It</a></li>
      </ul>
    </div>
    <div class="clearfix"></div>

  </div>

</div>

<div class="margin-top-50"></div>

</block>
